package com.ware.jfinal.plugin;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

public abstract class MY {
	private static SqlSessionFactory sessionFactory;
	
	public static void setSessionFactory(SqlSessionFactory factory){
		sessionFactory = factory;
	}
	
	public static SqlSessionFactory getSessionFactory(){
		return sessionFactory;
	}
		
	public static <T> T getMapper(Class<T> cls){
		return sessionFactory.openSession().getMapper(cls);
	}
	
	public static  SqlSession getSession(){
		return sessionFactory.openSession();
	}
}
